import type {RouteObject} from "react-router-dom";
import {Navigate} from "react-router-dom"
import * as React from 'react';
import {getCookie} from "utils/cookies";

const Workbench = React.lazy(() => import('views/workbench'))
const Venue = React.lazy(() => import('views/education/venue'))
const Ticket = React.lazy(() => import('views/education/ticket'))
const Order = React.lazy(() => import('views/education/order'))
const constantRouteMap: RouteObject[] = [
    {
        path: '/',
        element: <Navigate to={getCookie('mic-token') ? "/workbench" : '/'}/>,
    },
    {
        path: '/workbench',
        element: <Workbench/>,
    },
    {
        path: '/cultural',
        children: [
            {
                path: 'venue',
                element: <Venue/>,
            },
            {
                path: 'ticket',
                element: <Ticket/>,
            },
            {
                path: 'order',
                element: <Order/>,
            }
        ]
    }
]
export default constantRouteMap;

export const routers = [
    {
        code: 'cultural',
        name: '文化馆',
        iconName: 'education',
        children: [
            {
                code: 'venue',
                name: '场馆管理',
                isMe: true
            },
            {
                code: 'ticket',
                name: '门票管理',
                isMe: true
            },
            {
                code: 'order',
                name: '预约订单',
                isMe: true
            }
        ]
    }]